package com.hoyue.interact.service.impl;

import com.hoyue.common.utils.DateUtils;
import com.hoyue.interact.bean.Reply;
import com.hoyue.interact.bean.UserReply;
import com.hoyue.interact.dao.ReplyMapper;
import com.hoyue.interact.dao.UserReplyMapper;
import com.hoyue.interact.service.ReplyService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
public class ReplyServiceimpl implements ReplyService {


    @Resource
    ReplyMapper replyMapper;
    @Resource
    UserReplyMapper userReplyMapper;

    DateUtils dateUtils;

    @Override
    public List<Reply> ListReply(Integer id) {
        return userReplyMapper.ListReply(id);
    }

    @Override
    public Reply getReply(Integer id) {
        return replyMapper.getReply(id);
    }

    @Override
    public int addReply(UserReply userReply) {
        return userReplyMapper.addReply(userReply);
    }

    @Override
    public int insertReply(String replycontent, String userName, String commentId, Integer id) {
        Date Rtime = dateUtils.getDateTime();
        System.out.println("这个是impl的"+replycontent);
        System.out.println(userName);
        Reply reply=new Reply(replycontent,Rtime,userName);

        replyMapper.insertReply(reply);
        return reply.getId();
    }
    }






